#!/usr/bin/env python3.9
# -*- encoding: utf-8 -*-
'''
@文件        :enums.py
@说明        :自定义状态码枚举类
@时间        :2022/11/28 20:26:25
@作者        :Mars
@版本        :1.0
'''

from enum import Enum


class StatusCodeEnum(Enum):
    """状态码枚举类"""

    OK = (0, '操作成功')
    ERROR = (-1, '错误')
    SERVER_ERR = (500, '服务器异常')

    THROTTLING_ERR = (4002, '访问过于频繁')
    NECESSARY_PARAM_ERR = (4003, '缺少必传参数')

    DB_ERR = (5000, '数据库错误')
    EMAIL_ERR = (5001, '邮箱错误')
    NODATA_ERR = (5003, '无数据')
    TOKEN_ERR = (5005,'请提供有效token')
    PARAM_ERR = (5006, '参数错误')

    # 调用腾讯服务错误
    WE_NODATA_ERR = (6000,'腾讯接口无响应')
    WE_CODE_ERR = (6001,'code码无效')
    WE_OPENID_ERR = (6002,'无效的openid')
    WE_PAY_ERR = (6003,'微信支付错误')
    WE_NOTIFY_ERR = (6004,'微信支付回调异常')

    
    # 调用阿里云服务错误
    ALI_NOCONFIG_ERR = (7001,'未配置阿里云参数')
    ALI_API_ERR = (7002,'调用阿里云API异常')

    @property
    def code(self):
        """获取状态码"""
        return self.value[0]

    @property
    def errmsg(self):
        """获取状态码信息"""
        return self.value[1]
